package com.itheima.demo;

import com.itheima.domain.User;
import com.itheima.utils.UserUtil;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Demo1 {
    public static void main(String[] args) {
//        UserUtil u = new UserUtil();
//        User user = u.getUser();


        User u1 = UserUtil.getUser1();


        //创建spring IOC 容器
        ApplicationContext ac = new ClassPathXmlApplicationContext("spring1.xml");
        //从IOC中获取bean对象

        User user1 = (User) ac.getBean("u1");
        user1.testUser();
    }
}
